package com.hd.abc.sersions.serimpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hd.abc.dao.dao;
import com.hd.abc.sersions.ser;
import com.hd.abc.user.user;
import com.hd.abc.user.username;
import com.sun.org.apache.bcel.internal.generic.DALOAD;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class serimpl implements ser {

    @Autowired
    private dao d;

    @Override
    public PageInfo<user> querylimitdata(Integer pageindex) {
        //分页
        PageHelper.startPage (pageindex,2);
        List<user> queryall = d.queryall ();
        PageInfo<user> a=new PageInfo<> (queryall);
        return a;
    }

    @Override
    public int deldataa(int id) {
        int deldata = d.deldata (id);
        return deldata;
    }
/**
*@Author hd
*@Date 2021/11/19 18:57
*@Description  修改
*/
    @Override
    public int updatedata(user user) {
        int updatedata = d.updatedata (user);
        return updatedata;
    }
/**
*@Author hd
*@Date 2021/11/19 18:58
*@Description  查询指定
*/
    @Override
    public user queryonedata(int id) {
        user queryone = d.queryone (id);
        return queryone;
    }

    @Override
    public List<username> queryusername() {
        return d.queryallusername ();
    }

    @Override
    public PageInfo<user> querynamealla(int categoryid) {
        PageHelper.startPage (2,2);
        List<user> querynameall = d.querynameall (categoryid);
        PageInfo<user> a=new PageInfo<> (querynameall);
        return a;
    }

    @Override
    public int adddataall(user user) {
        int addalldata = d.addalldata (user);
        return addalldata;
    }
}
